package com.wang.commons.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PasswrodUtis {
    //密码长度为8到20位,必须包含字母和数字，字母区分大小写
    private static String regEx1 = "^(?=.*[0-9])(?=.*[a-zA-Z])(.{8,15})$";

    /**
     * 密码长度为8到15位,必须包含字母和数字，字母区分大小写
     * @param password
     * @return
     */
    public static boolean checkPassword(String password){
        Pattern Password_Pattern = Pattern.compile(regEx1);
        Matcher matcher = Password_Pattern.matcher(password);
        if (matcher.matches()) {
            return true;
        }
        return false;
    }

//    public static void main(String[] args) {
//        String str = "1234hygG";
//        boolean b = checkPassword(str);
//        System.out.println(b);
//    }

}
